package day04;

import jakarta.servlet.ServletException;
import jakarta.servlet.annotation.WebServlet;
import jakarta.servlet.http.Cookie;
import jakarta.servlet.http.HttpServlet;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import util.CookieUtil;

import java.io.IOException;

@WebServlet("/removeCookie")
public class RemoveCookieServlet extends HttpServlet {

    @Override
    protected void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        System.out.println("RemoveCookieServlet.service()");

//        Cookie cookie=new Cookie("username","");
//
//        cookie.setMaxAge(0);
//
//        response.addCookie(cookie);

        CookieUtil.removeCookie("username",response);

    }
}
